package com.example.a10928.weifriend.adapter

import android.content.Intent
import android.graphics.drawable.Drawable
import android.support.v7.widget.RecyclerView
import android.text.TextUtils
import android.view.View
import android.widget.ImageView

import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.BaseViewHolder
import com.example.a10928.weifriend.App.activity
import com.example.a10928.weifriend.R
import com.example.a10928.weifriend.http.api.Api
import com.example.a10928.weifriend.http.api.base.CarMallBean
import com.example.a10928.weifriend.ui.home.WebViewActivity
import com.squareup.picasso.Picasso

class CarStoreAdapter(layoutResId: Int, data: List<CarMallBean.CarMallDataBean>) : BaseQuickAdapter<CarMallBean.CarMallDataBean, BaseViewHolder>(layoutResId, data) {
    override fun convert(helper: BaseViewHolder?, item: CarMallBean.CarMallDataBean?) {
        val iv = helper!!.itemView.findViewById<ImageView>(R.id.item_car_store_iv)
        Picasso.with(mContext).load(item!!.mall_image).into(iv)
        helper!!.itemView.setOnClickListener {
            var intent = Intent(mContext, WebViewActivity::class.java)
            intent.putExtra(WebViewActivity.DADA_WEBVIEW_URL, item!!.mall_url)
            intent.putExtra(WebViewActivity.DADA_WEBVIEW_TITLE, WebViewActivity.SOURCE_CAR_MALL)
            activity.startActivity(intent)
        }
    }

}
